<template>
	<view class="democratic-view">
		<view class="democratic-list">
			<scroll-view
			     class="scroll-view"
			     scroll-y
			     @scrolltolower="getDataList"
			   >
				<view class="democratic-item" v-for="(item, index) in democraticList" :key="index" @tap="nav2Detail(item.id)">
					<view class="democratic-info">
						<view>
							<view class="title">{{item.title}}</view>
							<view class="time">{{item.createTime}}</view>
						</view>
					</view>
				</view>
				<view style="margin-top: 200rpx;">
					<up-empty
					mode="data" 
					iconSize="60" 
					text="暂无数据" 
					icon="https://jqgh-public.yqfoodec.com/20250405/%E7%BB%84%2016@2x_53897.png" 
					v-if="democraticList.length == 0"></up-empty>
				</view>
			</scroll-view>
		</view>
	<!-- 	<view class="single-submit-btn">
			<button size="mini" class="btn" @click="handleProposal">
				+我要提案
			</button>
		</view> -->
	</view>
</template>

<script>
	import {democraticApi} from '@/api/democratic/democratic-api.js';
	export default {
		data() {
			return {
				// 0待附议|#F59A23（添加附议人，编辑，删除），1待审核|#02A7F0，2同意立案|#04D919（评价），3不同意立案|#F20C0C（编辑）
				democraticList: [
					
				],
				colorList: ['#F59A23', '#02A7F0', '#04D919', '#F20C0C'],
				pageRequest:{
					page:1,
					limit:10,
				},
				hasMore:true,
			}
		},
		onLoad() {
			this.getDataList();
		},
		methods: {
			handleProposal() {
				uni.navigateTo({
				    url: '../democratic-manage/proposal'
				});
			},
			nav2Detail(id){
				uni.navigateTo({
					url: '../democratic-manage/detail?id='+id
				})
			},
			async getDataList(){
				const result = await democraticApi.queryList(this.pageRequest);
				if(result.data.list.length > 0){
					this.democraticList.push(...result.data.list);
					this.pageRequest.page++;
				}else {
					this.hasMore = false;
					uni.showToast({
					  title: '没有更多数据了',
					  icon: 'none',
					});
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.democratic-view {
		padding: 30rpx;
		background-color: #F5F5F5;
		.democratic-list {
			height: 100vh;
			.scroll-view{
				height: 100vh;
			}
			// padding-bottom: 200rpx;
			.democratic-item {
				padding: 20rpx 20rpx 30rpx 20rpx;
				background: #fff;
				margin-bottom: 30rpx;
				.democratic-info {
					display: flex;
					justify-content: space-between;
					// margin-bottom: 30rpx;
					.title {
						font-size: 32rpx;
						color: rgb(51, 51, 51);
						margin-bottom: 10rpx;
					}
					.time {
						font-size: 24rpx;
						color: rgb(153, 153, 153);
					}
					.status {
						font-size: 26rpx;
						color: #F59A23;
					}
				}
				.btn-view {
					display: flex;
				}
				.single-btn {
					display: flex;
					justify-content: start;
				}
			}
		}
		
	}
</style>